﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Data.Linq.Mapping;

namespace Inbox.Domain
{
    [global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Machine_Planning")]
    public class Machine_Planning
    {
        private Guid? _Machine_ID, _Planning_ID;
        private string _Despription;
        protected Guid _ID;
        protected bool _deleted;
        protected string _createUser;
        protected DateTime _createDate;
        protected Binary _timeStamp;

        [Column(Storage = "_Machine_ID", DbType = "UniqueIdentifier")]
        public Guid? Machine_ID
        {
            get { return this._Machine_ID; }
            set { this._Machine_ID = value; }
        }

        [Column(Name = "Planning_ID", Storage = "_Planning_ID", DbType = "UniqueIdentifier")]
        public Guid? Planning_ID
        {
            get { return this._Planning_ID; }
            set { this._Planning_ID = value; }
        }

        [Column(Name = "Description", Storage = "_Despription", DbType = "nvarchar(1000)")]
        public string Description
        {
            get { return this._Despription; }
            set { this._Despription = value; }
        }

        [Column(Name = "ID", Storage = "_ID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true, UpdateCheck = UpdateCheck.Never)]
        public Guid ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                this._ID = value;
            }
        }

        [Column(Storage = "_deleted", DbType = "Bit", UpdateCheck = UpdateCheck.Never)]
        public bool Deleted
        {
            get
            {
                return this._deleted;
            }
            set
            {
                this._deleted = value;
            }
        }

        [Column(Storage = "_createUser", DbType = "NVarChar(50)", UpdateCheck = UpdateCheck.Never)]
        public string CreateUser
        {
            get
            {
                return this._createUser;
            }
            set
            {
                this._createUser = value;
            }
        }

        [Column(Storage = "_createDate", DbType = "DateTime", UpdateCheck = UpdateCheck.Never)]
        public DateTime CreateDate
        {
            get
            {
                return this._createDate;
            }
            set
            {
                this._createDate = value;
            }
        }

        [Column(Storage = "_timeStamp", AutoSync = AutoSync.Always, DbType = "rowversion", IsDbGenerated = true, IsVersion = true, UpdateCheck = UpdateCheck.Never)]
        public System.Data.Linq.Binary TimeStamp
        {
            get
            {
                return this._timeStamp;
            }
        }

        //private EntityRef<Planning> _PlanningRef;
        //[Association(Name = "Planning_Machine_Planning", Storage = "_PlanningRef", ThisKey = "Planning_ID", OtherKey = "ID", IsForeignKey = true)]
        //public Planning Planning
        //{
        //    get
        //    {
        //        return this._PlanningRef.Entity;
        //    }
        //    set
        //    {
        //        if (value != null)
        //        {
        //            this.Planning_ID = value.ID;
        //        }
        //        else
        //            this.Planning_ID = Guid.Empty;
        //    }
        //}

        //private EntityRef<Machine> _MachineRef;

        //public Machine Machine
        //{
        //    get
        //    {
        //        return this._MachineRef.Entity;
        //    }
        //    set
        //    {
        //        if (value != null)
        //            this.Machine_ID = value.ID;
        //        else
        //            this.Machine_ID = Guid.Empty;
        //    }
        //}

        public Machine_Planning()
        {
            //this._MachineRef = default(EntityRef<Machine>);
            //this._PlanningRef = default(EntityRef<Planning>);
        }
    }
}
